﻿
var $ = jQuery.noConflict();
function changeProvince() {
    var provinceId = $("#province").val();
    var province = $("#province option:selected").text();
    $("#city").empty();
    $("<option value='0'>--请选择--</option>").appendTo($("#city"));
    $("#area").empty();
    $("<option value='0'>--请选择--</option>").appendTo($("#area"));
    if (provinceId == "0") {
        return;
    }
    var sData = "{'AddressID':'" + provinceId + "'}";

    $.get("/Handler/CommonHandler.ashx?action=GetAddresses", { AddressID: provinceId }, function (result) {
        var str = result.split("|");
        for (var i = 0; i < str.length; i++) {
            var st = str[i].split(",");
            $("#city").append("<option value='" + st[0].replace("\"", "") + "'>" + st[1].replace("\"", "") + "</option>");
        }
    })

}
function changeCity() {
    var cityID = $("#city").val();
    $("#hdcity").val($("#city option:selected").text());
    $("#area").empty();
    $("<option value='0'>--请选择--</option>").appendTo($("#area"));
    if (cityID == "0") {
        return;
    }
    if (cityID == "108") {
        $("#SelfBox").show();
    }
    else {
        $("#SelfBox").hide();
    }
    var sData = "{'AddressID':'" + cityID + "'}";
    $.get("/Handler/CommonHandler.ashx?action=GetAddresses", { AddressID: cityID }, function (result) {
        var str = result.split("|");
        for (var i = 0; i < str.length; i++) {
            var st = str[i].split(",");
            $("<option value='" + st[0].replace("\"", "") + "'>" + st[1].replace("\"", "") + "</option>").appendTo($("#area"));
        }
    })
    
}
function changeCounty() {
    $("#hdarea").val($("#area option:selected").text());
}